<html>
<head><meta charset="utf-8"><title>structural equality meeting · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html">structural equality meeting</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247346840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247346840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247346840">(Jul 27 2021 at 15:12)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="124288">@oli</span> , are you preparing a write-up for Wednesday’s structural equality meeting?</p>



<a name="247346969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247346969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247346969">(Jul 27 2021 at 15:13)</a>:</h4>
<p>No, but that seems like a rather good idea</p>



<a name="247391365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247391365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247391365">(Jul 27 2021 at 21:03)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/74446#issuecomment-841637790">My comment from last time</a> -- that was before the last meeting though. Not sure if we have a post-meeting writeup.</p>



<a name="247474840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247474840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247474840">(Jul 28 2021 at 15:32)</a>:</h4>
<p>Hey <span class="user-group-mention" data-user-group-id="1977">@T-lang</span> -- <span class="user-mention" data-user-id="116083">@pnkfelix</span> and I were debating about delaying the meeting, since we'd like to do more work on the intro</p>



<a name="247474904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247474904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247474904">(Jul 28 2021 at 15:33)</a>:</h4>
<p>Background: (I had intended to write it, but wound up getting busy, and <span class="user-mention" data-user-id="124288">@oli</span> tried to pick up the ball)</p>



<a name="247475143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475143">(Jul 28 2021 at 15:35)</a>:</h4>
<p>Deferring to one of the design meetings next month seems fine. Should we wait for you to get back from vacation, or have the meeting while you're gone?</p>



<a name="247475283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475283">(Jul 28 2021 at 15:36)</a>:</h4>
<p>Either is probably ok--</p>



<a name="247475298"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475298" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475298">(Jul 28 2021 at 15:36)</a>:</h4>
<p>I won't be able to do the writeup until afterwards</p>



<a name="247475312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475312">(Jul 28 2021 at 15:36)</a>:</h4>
<p>I'm on board, I think, with Ralf's design</p>



<a name="247475542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475542">(Jul 28 2021 at 15:38)</a>:</h4>
<p>Does the writeup include an explanation of valtrees for people who aren't familiar with them?</p>



<a name="247475560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475560">(Jul 28 2021 at 15:38)</a>:</h4>
<p>(I've seen the term many times, and I feel like I have a vague idea, but I'd like to have more than a vague idea.)</p>



<a name="247475567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475567">(Jul 28 2021 at 15:38)</a>:</h4>
<p>yes</p>



<a name="247475598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475598">(Jul 28 2021 at 15:38)</a>:</h4>
<p>feedback on whether it is sufficient is very welcome tho</p>



<a name="247475897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/247475897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#247475897">(Jul 28 2021 at 15:41)</a>:</h4>
<p>I'll cancel the calendar invite</p>



<a name="248499862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248499862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248499862">(Aug 05 2021 at 16:16)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116083">@pnkfelix</span> <a href="https://hackmd.io/Zrk3iPzOQDC5kOMC1B34_Q?both">https://hackmd.io/Zrk3iPzOQDC5kOMC1B34_Q?both</a></p>



<a name="248499897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248499897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248499897">(Aug 05 2021 at 16:16)</a>:</h4>
<p>thanks</p>



<a name="248499905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248499905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248499905">(Aug 05 2021 at 16:16)</a>:</h4>
<p>the structure of the doc changed a bit since last time you saw it</p>



<a name="248499921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248499921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248499921">(Aug 05 2021 at 16:16)</a>:</h4>
<p>yeah let me take a moment to read it</p>



<a name="248499954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248499954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248499954">(Aug 05 2021 at 16:16)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span> ping me when you're done</p>



<a name="248499995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248499995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248499995">(Aug 05 2021 at 16:17)</a>:</h4>
<p>do you want comments here, or via comments on doc, or via priv msg, or in separate topic?</p>



<a name="248500117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500117">(Aug 05 2021 at 16:18)</a>:</h4>
<p>we can just do it here</p>



<a name="248500150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500150">(Aug 05 2021 at 16:18)</a>:</h4>
<p>or comment on the doc if that is easier for you since you're reading it</p>



<a name="248500238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500238">(Aug 05 2021 at 16:19)</a>:</h4>
<p>"The TLDR is that we sometimes need to know that the <code>PartialEq</code> impl is equivalent to running the <code>PartialEq</code> impl of each field and using <code>&amp;&amp;</code> to combine the results.” ==&gt; <em>and</em> that the same property is applied recursively throughout all types involved in the comparison, right?</p>



<a name="248500678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500678">(Aug 05 2021 at 16:23)</a>:</h4>
<p>no <span aria-label="cry" class="emoji emoji-1f622" role="img" title="cry">:cry:</span> sadly not</p>



<a name="248500699"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500699" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500699">(Aug 05 2021 at 16:23)</a>:</h4>
<p><code>StructuralEq</code> is a shallow property at present</p>



<a name="248500717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500717">(Aug 05 2021 at 16:23)</a>:</h4>
<p>which causes all kinds of problems</p>



<a name="248500747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500747">(Aug 05 2021 at 16:24)</a>:</h4>
<p>but the “need to know"</p>



<a name="248500785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500785">(Aug 05 2021 at 16:24)</a>:</h4>
<p>pattern matching can handle that (by falling back to <code>PartialEq</code> for runtime comparison)</p>



<a name="248500804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500804">(Aug 05 2021 at 16:24)</a>:</h4>
<p>I think I understand that <code>StructuralEq</code> is shallow</p>



<a name="248500814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500814">(Aug 05 2021 at 16:24)</a>:</h4>
<p>but const generics needs it recursively</p>



<a name="248500832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500832">(Aug 05 2021 at 16:24)</a>:</h4>
<p>the same goes for the need to know</p>



<a name="248500849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500849">(Aug 05 2021 at 16:24)</a>:</h4>
<p>but we still try to enforce it deeply, via the nature of how its used via <code>derive</code>, right?</p>



<a name="248500861"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500861" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500861">(Aug 05 2021 at 16:24)</a>:</h4>
<p>the fallback works just fine later in the deconstruction of the const</p>



<a name="248500869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500869">(Aug 05 2021 at 16:24)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248500849">said</a>:</p>
<blockquote>
<p>but we still try to enforce it deeply, via the nature of how its used via <code>derive</code>, right?</p>
</blockquote>
<p>no</p>



<a name="248500875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500875">(Aug 05 2021 at 16:25)</a>:</h4>
<p>Well in any case</p>



<a name="248500927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500927">(Aug 05 2021 at 16:25)</a>:</h4>
<p>that paragraph says “we sometimes need to know"</p>



<a name="248500929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500929">(Aug 05 2021 at 16:25)</a>:</h4>
<p>it's literally expanding to <code>impl&lt;T&gt; StructuralEq for Type&lt;T&gt; {}</code>, no field bounds, no generic bounds</p>



<a name="248500939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500939">(Aug 05 2021 at 16:25)</a>:</h4>
<p>if the need-to-know is itself recursive</p>



<a name="248500943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500943">(Aug 05 2021 at 16:25)</a>:</h4>
<p>the sometimes is meant for the compiler</p>



<a name="248500966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500966">(Aug 05 2021 at 16:25)</a>:</h4>
<p>then that should be reflected in what we write there</p>



<a name="248500970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500970">(Aug 05 2021 at 16:25)</a>:</h4>
<p>which is what I was suggesting</p>



<a name="248500971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248500971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248500971">(Aug 05 2021 at 16:25)</a>:</h4>
<p>ok</p>



<a name="248501045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248501045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248501045">(Aug 05 2021 at 16:26)</a>:</h4>
<p>(its useful to then also note where we fail to enforce that)</p>



<a name="248501315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248501315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248501315">(Aug 05 2021 at 16:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248500929">said</a>:</p>
<blockquote>
<p>it's literally expanding to <code>impl&lt;T&gt; StructuralEq for Type&lt;T&gt; {}</code>, no field bounds, no generic bounds</p>
</blockquote>
<p>Hmm. I did know that. but I thought it was still enforced somehow</p>



<a name="248501338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248501338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248501338">(Aug 05 2021 at 16:28)</a>:</h4>
<p>i.e. via special case code in the derive or something</p>



<a name="248501344"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248501344" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248501344">(Aug 05 2021 at 16:28)</a>:</h4>
<p>let me go look</p>



<a name="248502141"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502141" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502141">(Aug 05 2021 at 16:35)</a>:</h4>
<p>so with the rewrite you just put in</p>



<a name="248502205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502205">(Aug 05 2021 at 16:35)</a>:</h4>
<p>"For pattern matching … We do not need to know that this property applies to the fields of whatever we are matching on … We can always fall back to … <code>PartialEq::eq</code> … "</p>



<a name="248502272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502272">(Aug 05 2021 at 16:36)</a>:</h4>
<p>the whole point I thought we tried to make with the StructuralEq trait</p>



<a name="248502283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502283">(Aug 05 2021 at 16:36)</a>:</h4>
<p>was that the reason we <em>could</em> fallback in that manner</p>



<a name="248502294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502294">(Aug 05 2021 at 16:36)</a>:</h4>
<p>no</p>



<a name="248502311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502311">(Aug 05 2021 at 16:36)</a>:</h4>
<p>we can always fallback, that is perfectly safe</p>



<a name="248502317"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502317" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502317">(Aug 05 2021 at 16:36)</a>:</h4>
<p>was because the PartialEq was going to be forced to match up with the semantics</p>



<a name="248502326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502326">(Aug 05 2021 at 16:36)</a>:</h4>
<p>i.e.</p>



<a name="248502341"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502341" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502341">(Aug 05 2021 at 16:36)</a>:</h4>
<p>that there was no potential for confusion</p>



<a name="248502366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502366">(Aug 05 2021 at 16:36)</a>:</h4>
<p>where the PartialEq::eq would deviate from naive structural traversal</p>



<a name="248502410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502410">(Aug 05 2021 at 16:37)</a>:</h4>
<p>(Except, I suppose, for floating point… sigh.)</p>



<a name="248502416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502416">(Aug 05 2021 at 16:37)</a>:</h4>
<p>right, but we need this property in order to take apart e.g. <code>const FOO: (i32, i32) = (42, 43);</code> into a tuple pattern</p>



<a name="248502477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502477">(Aug 05 2021 at 16:37)</a>:</h4>
<p>we will fall back for <code>(i32, NotStructEq)</code> only when we have taken apart the outer layer and then call <code>PartialEq</code> on the <code>NotStructEq</code> type</p>



<a name="248502548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502548">(Aug 05 2021 at 16:38)</a>:</h4>
<p>because if a type implements <code>StructuralEq</code>, we know converting to a pattern will not cause any change in behaviour</p>



<a name="248502591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502591">(Aug 05 2021 at 16:38)</a>:</h4>
<p>the breaking change would be to forbid <code>!StructuralEq</code> types from pattern matching in general, but I fear that ship has sailed</p>



<a name="248502638"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248502638" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248502638">(Aug 05 2021 at 16:39)</a>:</h4>
<p>i guess let me read the whole doc. I’ll stop trying to give feedback part way through</p>



<a name="248503311"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248503311" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248503311">(Aug 05 2021 at 16:45)</a>:</h4>
<p>(It probably would be good to give a concrete example of where match falls back to manually implemented <code>PartialEq</code> today. I think I know what this was talking about but I wouldn’t want to try to reconstruct it on the fly if asked.)</p>



<a name="248503945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248503945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248503945">(Aug 05 2021 at 16:50)</a>:</h4>
<blockquote>
<p>For pattern matching it is “sufficient” to know this for the type of a constant that we are pattern matching. </p>
</blockquote>
<p>why can we not start out with <em>just</em> always using <code>PartialEq</code> for consts</p>



<a name="248503991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248503991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248503991">(Aug 05 2021 at 16:50)</a>:</h4>
<p>i.e. why is it required for the root of a constant to be <code>StructuralEq</code> during pattern matching?</p>



<a name="248504095"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504095" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504095">(Aug 05 2021 at 16:51)</a>:</h4>
<p>because that is a breaking change</p>



<a name="248504161"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504161" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504161">(Aug 05 2021 at 16:52)</a>:</h4>
<p>we always used to destructure at least some constants</p>



<a name="248504185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504185">(Aug 05 2021 at 16:52)</a>:</h4>
<p>if we stop doing it, you get errors because you are missing match arms</p>



<a name="248504356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504356">(Aug 05 2021 at 16:53)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">FOO</span>: <span class="p">(</span><span class="kt">bool</span><span class="p">,</span><span class="w"> </span><span class="kt">bool</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kc">true</span><span class="p">,</span><span class="w"> </span><span class="kc">true</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="p">(</span><span class="kc">true</span><span class="p">,</span><span class="w"> </span><span class="kc">false</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">FOO</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="p">(</span><span class="kc">true</span><span class="p">,</span><span class="w"> </span><span class="kc">false</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">        </span><span class="p">(</span><span class="kc">false</span><span class="p">,</span><span class="w"> </span><span class="kc">false</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">        </span><span class="p">(</span><span class="kc">false</span><span class="p">,</span><span class="w"> </span><span class="kc">true</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>works on stable</p>



<a name="248504358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504358">(Aug 05 2021 at 16:53)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="p">;</span><span class="w"></span>
<span class="k">const</span><span class="w"> </span><span class="n">FOO</span>: <span class="nc">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="p">;</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">FOO</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">(),</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248504386"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504386" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504386">(Aug 05 2021 at 16:53)</a>:</h4>
<p>yeah, but my example does not</p>



<a name="248504430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504430">(Aug 05 2021 at 16:54)</a>:</h4>
<p>and as long as we destructure constants for types which implement <code>StructuralEq</code></p>



<a name="248504491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504491">(Aug 05 2021 at 16:54)</a>:</h4>
<p>we don't break anything as currently only these types are allowed</p>



<a name="248504591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504591">(Aug 05 2021 at 16:55)</a>:</h4>
<p>so we could allow constants of types which only implement <code>PartialEq</code>, strictly allowing more code to compile and making <code>StructuralEq</code> only relevant for exhaustiveness checking (from the perspective of the user)</p>



<a name="248504693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504693">(Aug 05 2021 at 16:55)</a>:</h4>
<p>interesting, seems we already did the breaking change: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c37b56c9d6788539d9448e486ab02f1b">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c37b56c9d6788539d9448e486ab02f1b</a></p>



<a name="248504775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504775">(Aug 05 2021 at 16:56)</a>:</h4>
<p>there's still a future incompat lint, but also a hard error</p>



<a name="248504897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248504897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248504897">(Aug 05 2021 at 16:57)</a>:</h4>
<p>anyway, yea looks like we could make it recursive and just fall back to <code>PartialEq</code> at the top level</p>



<a name="248505420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248505420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248505420">(Aug 05 2021 at 17:00)</a>:</h4>
<p>will u update the doc, or should i?</p>



<a name="248505716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248505716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248505716">(Aug 05 2021 at 17:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248504693">said</a>:</p>
<blockquote>
<p>interesting, seems we already did the breaking change: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c37b56c9d6788539d9448e486ab02f1b">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c37b56c9d6788539d9448e486ab02f1b</a></p>
</blockquote>
<p>sorry, when did you think that code worked?</p>



<a name="248506016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506016">(Aug 05 2021 at 17:04)</a>:</h4>
<p>(or at least, I’m having trouble finding a version on godbolt that accepted it, or simple variations of it I made to address nits from older compilers…)</p>



<a name="248506075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506075">(Aug 05 2021 at 17:04)</a>:</h4>
<p>hmm... let me look at the tests, we have <em>something</em> that used to work, but it is really subtle</p>



<a name="248506153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506153">(Aug 05 2021 at 17:05)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> biggest feedback on doc that I haven’t already given: If you can, you should stake out a position, preferably early on, about what solution (or set of solutions) we should adopt. Its great to give an overview of the design space, but it also can really help the conversation if we start off with some clue as to what the expert prefers.</p>



<a name="248506193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506193">(Aug 05 2021 at 17:05)</a>:</h4>
<p>its not like it commits us. It just can help direct conversation</p>



<a name="248506265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506265">(Aug 05 2021 at 17:06)</a>:</h4>
<p>ah yes, it compiles if you manually implement <code>Eq</code> and <code>PartialEq</code> in broken ways</p>



<a name="248506299"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506299" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506299">(Aug 05 2021 at 17:06)</a>:</h4>
<p>of course, if you literally have not idea what is best, then I guess you can say that. but its better to then figure out what questions you would want to answer in order to know what would be best</p>



<a name="248506322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506322">(Aug 05 2021 at 17:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248506265">said</a>:</p>
<blockquote>
<p>ah yes, it compiles if you manually implement <code>Eq</code> and <code>PartialEq</code> in broken ways</p>
</blockquote>
<p>ah of course</p>



<a name="248506359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506359">(Aug 05 2021 at 17:06)</a>:</h4>
<p>yea, I have solutions spread out through the doc, I will merge them into one chapter</p>



<a name="248506640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506640">(Aug 05 2021 at 17:08)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248506265">said</a>:</p>
<blockquote>
<p>ah yes, it compiles if you manually implement <code>Eq</code> and <code>PartialEq</code> in broken ways</p>
</blockquote>
<p>but don’t you also have to also add a wildcard or other arm to to cover the <code> &amp;&amp;(true, &amp;&amp;Foo)</code> case, because the exhaustiveness checker could not figure that out?</p>



<a name="248506765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506765">(Aug 05 2021 at 17:09)</a>:</h4>
<p>or at least, that’s what I observe via godbolt for rust 1.50.0</p>



<a name="248506864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248506864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248506864">(Aug 05 2021 at 17:10)</a>:</h4>
<p>or no, the version I get that’s accepted on 1.50.0 is also accepted on 1.54.0. So never mind.</p>



<a name="248507915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248507915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248507915">(Aug 05 2021 at 17:19)</a>:</h4>
<blockquote>
<p>make <code>StructuralEq</code> recursive, unsafe </p>
</blockquote>
<p>what's the reason to make <code>StructuralEq</code> unsafe? I opted against that in my proposal as incorrect impls should just cause surprising, but not undefined behavior</p>



<a name="248508140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248508140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248508140">(Aug 05 2021 at 17:20)</a>:</h4>
<p>yea, I don't like that option, just listing it</p>



<a name="248508150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248508150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248508150">(Aug 05 2021 at 17:20)</a>:</h4>
<p>the third option is the one I like</p>



<a name="248508550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248508550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248508550">(Aug 05 2021 at 17:23)</a>:</h4>
<blockquote>
<ol start="3">
<li>hard error on using types that don’t have a derived PartialEq + Eq impl in patterns</li>
</ol>
</blockquote>
<p>a recursively derived <code>PartialEq + Eq</code> impl?</p>



<a name="248508803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248508803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248508803">(Aug 05 2021 at 17:25)</a>:</h4>
<p>yes</p>



<a name="248509821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248509821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248509821">(Aug 05 2021 at 17:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248508140">said</a>:</p>
<blockquote>
<p>yea, I don't like that option, just listing it</p>
</blockquote>
<p>It's not that i don't like that option (though i might), but that I don't understand it</p>



<a name="248509946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248509946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248509946">(Aug 05 2021 at 17:34)</a>:</h4>
<p>i.e. it seems to me like however I imagine that proposal, it's made worse by <code>StructuralEq</code> being unsafe</p>



<a name="248520290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248520290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248520290">(Aug 05 2021 at 18:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248509946">said</a>:</p>
<blockquote>
<p>i.e. it seems to me like however I imagine that proposal, it's made worse by <code>StructuralEq</code> being unsafe</p>
</blockquote>
<p>if it were safe and you could implement it, it would not be better? Not sure I understand your point XD</p>



<a name="248524296"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248524296" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248524296">(Aug 05 2021 at 19:27)</a>:</h4>
<p><code>StructuralEq</code> being unsafe without any safety requirements is nonsense</p>



<a name="248524338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248524338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248524338">(Aug 05 2021 at 19:27)</a>:</h4>
<p>so there would have to be some way to implement <code>StructuralEq</code> and be unsound</p>



<a name="248524548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248524548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248524548">(Aug 05 2021 at 19:29)</a>:</h4>
<p>and except the compiler being able to assume that partialeq is equal to structural eq and using partialeq impls even though the const was considered during exhaustiveness checking I can't think of reasons to have these as safety requirements</p>



<a name="248524657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248524657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248524657">(Aug 05 2021 at 19:30)</a>:</h4>
<p>and doing that seems worse than just not doing it</p>



<a name="248542515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248542515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248542515">(Aug 05 2021 at 21:56)</a>:</h4>
<p>i was thinking about const generics. if you end up with two different constants that are equal, that sounds problematic</p>



<a name="248585552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248585552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248585552">(Aug 06 2021 at 08:47)</a>:</h4>
<p>const generics also uses structural equality though?</p>



<a name="248585639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248585639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248585639">(Aug 06 2021 at 08:48)</a>:</h4>
<p>i don't think that the following causing a panic is a soundness concern</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="nc">WeirdType</span><span class="o">&gt;</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="fm">assert_eq!</span><span class="p">(</span><span class="n">N</span><span class="p">,</span><span class="w"> </span><span class="n">N</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248585855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248585855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248585855">(Aug 06 2021 at 08:51)</a>:</h4>
<p>(I quite like my proposal - <a href="https://hackmd.io/-IB2BH1hSWWMQVSfbvVViA">https://hackmd.io/-IB2BH1hSWWMQVSfbvVViA</a> - that's why I've made it)</p>
<p>This proposal pretty much boils down to</p>
<blockquote>
<ol>
<li>do nothing, lazy fallback (keep complex fragile system with some surprising behaviour)</li>
</ol>
</blockquote>
<p>except that it's actually (imo) nicely defined and fairly straightforward to understand (at least once we've added better docs to that proposal)</p>



<a name="248585997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248585997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248585997">(Aug 06 2021 at 08:53)</a>:</h4>
<p>As I don't think 3. is feasable (nor do i like it too much) I want to only compare it with "2. eager fallback" here</p>



<a name="248586624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248586624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248586624">(Aug 06 2021 at 09:00)</a>:</h4>
<p><del>The way 1. and 2. differ is that 1. allows some types to participate in exhaustiveness checking which simply use <code>PartialEq</code> with proposal 2</del></p>



<a name="248586978"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248586978" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248586978">(Aug 06 2021 at 09:05)</a>:</h4>
<p>The way 1. and 2. differ is that 1. would have more unreachable pattern warnings when using a constant after an ordinary pattern.</p>



<a name="248587249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248587249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248587249">(Aug 06 2021 at 09:08)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">NonStructuralEq</span><span class="p">(</span><span class="kt">bool</span><span class="p">);</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="nb">PartialEq</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">NonStructuralEq</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">eq</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="kp">&amp;</span><span class="nc">Self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">bool</span> <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">self</span><span class="p">.</span><span class="mi">0</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">other</span><span class="p">.</span><span class="mi">0</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="cp">#[derive(PartialEq, Eq)]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">value</span>: <span class="kt">bool</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">other</span>: <span class="nc">NonStructuralEq</span><span class="p">,</span><span class="w"></span>

<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">FOO</span>: <span class="nc">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span>: <span class="nc">true</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="nc">NonStructuralEq</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">FOO</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span>: <span class="nc">true</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="nc">_</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="n">FOO</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"> </span><span class="c1">// Warns with proposal 1, doesn't warn with proposal 2</span>
<span class="w">        </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span>: <span class="nc">false</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="nc">_</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248590342"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248590342" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248590342">(Aug 06 2021 at 09:48)</a>:</h4>
<p>My complaint with your proposal is that it allows <code>other: *const i32</code>, which means we can't eagerly convert to valtree</p>



<a name="248590533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248590533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248590533">(Aug 06 2021 at 09:50)</a>:</h4>
<p>I'd be fine declaring that const-&gt;pat is not the same as runtime equality if the user declares this explicitly, but I want eager conversion to valtrees so we don't have to maintain two systems for deconstructing constants (one for generating valtrees, one for taking apart <code>ConstValue</code> allocations)</p>



<a name="248590565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248590565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248590565">(Aug 06 2021 at 09:50)</a>:</h4>
<p>oh tbh we could implement the valtree generation in terms of the system taking apart <code>ConstValue</code>, so it's probably not as bad, but still..</p>



<a name="248604132"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604132" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604132">(Aug 06 2021 at 12:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248500699">said</a>:</p>
<blockquote>
<p><code>StructuralEq</code> is a shallow property at present</p>
</blockquote>
<p><em>at present</em>, yes, but I think there's no good reason for this and we should fix that</p>



<a name="248604405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604405">(Aug 06 2021 at 12:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248524296">said</a>:</p>
<blockquote>
<p><code>StructuralEq</code> being unsafe without any safety requirements is nonsense</p>
</blockquote>
<p>why would there be no safety requirements? in my proposals there always were very precise safety requirements... I guess I need to figure out how much of that made it into <span class="user-mention" data-user-id="124288">@oli</span>'s document ;)</p>



<a name="248604452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604452">(Aug 06 2021 at 12:33)</a>:</h4>
<p>none made it in XD</p>



<a name="248604455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604455">(Aug 06 2021 at 12:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248590565">said</a>:</p>
<blockquote>
<p>oh tbh we could implement the valtree generation in terms of the system taking apart <code>ConstValue</code>, so it's probably not as bad, but still..</p>
</blockquote>
<p>yeah I agree, valtrees should <em>replace</em> the current "destructure const" stuff</p>



<a name="248604533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604533">(Aug 06 2021 at 12:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248604452">said</a>:</p>
<blockquote>
<p>none made it in XD</p>
</blockquote>
<p>hm I guess I'd appreciate a comparison with <a href="https://github.com/rust-lang/rust/issues/74446#issuecomment-841637790">https://github.com/rust-lang/rust/issues/74446#issuecomment-841637790</a> then. it does no good to ignore prior work. ;)</p>



<a name="248604713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604713">(Aug 06 2021 at 12:36)</a>:</h4>
<blockquote>
<p>RalfJ wants either 2/3 as far as @oli-obk can tell</p>
</blockquote>
<p>I think it'd be something like 2: check if the type implements <code>StrucutralEq</code> (which is an unsafe trait with precise safety requirements); if yes build valtree, else treat opaquely.</p>



<a name="248604770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604770">(Aug 06 2021 at 12:37)</a>:</h4>
<p>implementing <code>StrucutralEq</code> roughly corresponds to "PartialEq + Eq is derived (recursively)", except it's a semantic condition, not a syntactic one</p>



<a name="248604806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248604806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248604806">(Aug 06 2021 at 12:37)</a>:</h4>
<p>(it must essentially <em>behave like</em> the derived impl, but it doesn't actually have to be literally derived)</p>



<a name="248605551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248605551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248605551">(Aug 06 2021 at 12:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248604533">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248604452">said</a>:</p>
<blockquote>
<p>none made it in XD</p>
</blockquote>
<p>hm I guess I'd appreciate a comparison with <a href="https://github.com/rust-lang/rust/issues/74446#issuecomment-841637790">https://github.com/rust-lang/rust/issues/74446#issuecomment-841637790</a> then. it does no good to ignore prior work. <span aria-label="wink" class="emoji emoji-1f609" role="img" title="wink">:wink:</span></p>
</blockquote>
<p>I didn't ignore it. I declared the trait to be unsafe after all</p>



<a name="248605595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248605595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248605595">(Aug 06 2021 at 12:47)</a>:</h4>
<p>the point lcnr makes is that it doesn't have to be. We can just go with post monomorphization errors and odd behaviour if the user breaks the contract, but there is no unsoundness</p>



<a name="248605781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248605781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248605781">(Aug 06 2021 at 12:48)</a>:</h4>
<p>yeah I read the text now, sorry for commenting too early</p>



<a name="248605792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248605792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248605792">(Aug 06 2021 at 12:48)</a>:</h4>
<p>I left some comments in the hackmd :D</p>



<a name="248605974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248605974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248605974">(Aug 06 2021 at 12:51)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248605595">said</a>:</p>
<blockquote>
<p>the point lcnr makes is that it doesn't have to be. We can just go with post monomorphization errors and odd behaviour if the user breaks the contract, but there is no unsoundness</p>
</blockquote>
<p>unsoundness is always close when discussing exhaustiveness checking. so at the least we need to guarantee that if a pattern works via valtrees and is considered for exhaustiveness, then rustc emits its own comparison code.<br>
it would be unsound to treat a const in a pattern like a valtree but later call <code>PartialEq::eq</code> at runtime.</p>



<a name="248606128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248606128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248606128">(Aug 06 2021 at 12:52)</a>:</h4>
<p>other than that... yeah I think this might not lead to UB in the literal sense. but it "breaks the language" in the sense of pattern matching disagreeing with <code>==</code> and in the sense of post-monomorphization errors (alongside all the technical debt we'll accumulate to ensure those are reasonably clear for users)</p>



<a name="248606522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248606522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248606522">(Aug 06 2021 at 12:56)</a>:</h4>
<p>"breaks the language" already kind of happens when hash/eq disagree, or when deref is not reliably returning the same thing</p>



<a name="248606597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248606597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248606597">(Aug 06 2021 at 12:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248605974">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248605595">said</a>:</p>
<blockquote>
<p>the point lcnr makes is that it doesn't have to be. We can just go with post monomorphization errors and odd behaviour if the user breaks the contract, but there is no unsoundness</p>
</blockquote>
<p>unsoundness is always close when discussing exhaustiveness checking. so at the least we need to guarantee that if a pattern works via valtrees and is considered for exhaustiveness, then rustc emits its own comparison code.<br>
it would be unsound to treat a const in a pattern like a valtree but later call <code>PartialEq::eq</code> at runtime.</p>
</blockquote>
<p>yea, if you can convert to a valtree, you get a full conversion to a pattern</p>



<a name="248607373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248607373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248607373">(Aug 06 2021 at 13:04)</a>:</h4>
<blockquote>
<p>We can just go with post monomorphization errors</p>
</blockquote>
<p>My proposal would not result in post mono errors</p>



<a name="248607420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248607420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248607420">(Aug 06 2021 at 13:04)</a>:</h4>
<p>as <strong>the compiler itself</strong> can prevent any <code>StructuralEq</code> impl (which are a shallow requirement in my proposal) which does not result in a valid val tree</p>



<a name="248607562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248607562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248607562">(Aug 06 2021 at 13:06)</a>:</h4>
<p>so types which implement deep <code>StructuralEq</code> are always representable as a val tree, their structural equality might however disagree with the <code>PartialEq</code> impl, which is not required for soundness</p>



<a name="248607818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248607818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248607818">(Aug 06 2021 at 13:08)</a>:</h4>
<p>we need a recursive <code>StructuralEq</code> for const generics</p>



<a name="248607864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248607864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248607864">(Aug 06 2021 at 13:09)</a>:</h4>
<p>are you suggesting we have two slightly different notions and have to explain both of them to everyone? that's a lot of extra complexity, and I see insufficient benefit from doing so.</p>



<a name="248607941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248607941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248607941">(Aug 06 2021 at 13:09)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248607864">said</a>:</p>
<blockquote>
<p>are you suggesting we have two slightly different notions and have to explain both of them to everyone? that's a lot of extra complexity, and I see insufficient benefit from doing so.</p>
</blockquote>
<p>my suggestion is <a href="https://hackmd.io/-IB2BH1hSWWMQVSfbvVViA">https://hackmd.io/-IB2BH1hSWWMQVSfbvVViA</a></p>



<a name="248608052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608052">(Aug 06 2021 at 13:10)</a>:</h4>
<p>so yes, my suggestion uses two different traits, one for shallow and one for deep "val tree-ness"/"structural equality"</p>



<a name="248608083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608083">(Aug 06 2021 at 13:10)</a>:</h4>
<p>May i ask a question though... Why not just use <code>impl const PartialEq</code> or <code>impl const Eq</code> for  const generics? Are there some cons for this approach?</p>



<a name="248608133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608133">(Aug 06 2021 at 13:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248608083">said</a>:</p>
<blockquote>
<p>May i ask a question though... Why not just use <code>impl const PartialEq</code> or <code>impl const Eq</code> for  const generics? Are there some cons for this approach?</p>
</blockquote>
<p>how should we deal with non-reflexive <code>PartialEq</code> impls in that case? i.e. if <code>a == a</code> returns <code>false</code></p>



<a name="248608138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608138">(Aug 06 2021 at 13:11)</a>:</h4>
<p>it doesnt work for <code>const_evaluatable_checked</code> where we need equality between expressions which are too generic to evaluate i.e. <code>N + 1</code></p>



<a name="248608247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608247">(Aug 06 2021 at 13:12)</a>:</h4>
<p>Emit a warning or something?</p>



<a name="248608274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608274">(Aug 06 2021 at 13:12)</a>:</h4>
<p>If it matters, the compiler can check it, right?</p>



<a name="248608280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608280">(Aug 06 2021 at 13:12)</a>:</h4>
<p>we probably have to hard error in that case</p>



<a name="248608305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608305">(Aug 06 2021 at 13:12)</a>:</h4>
<p>but also</p>



<a name="248608334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608334">(Aug 06 2021 at 13:12)</a>:</h4>
<p>if 2 variables are equal using <code>PartialEq</code> but not equal in behavior</p>



<a name="248608378"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608378" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608378">(Aug 06 2021 at 13:13)</a>:</h4>
<p>we can easily get unsoundness</p>



<a name="248608388"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608388" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608388">(Aug 06 2021 at 13:13)</a>:</h4>
<p>yea, <code>const PartialEq</code> does not give us the guarantees we want.</p>



<a name="248608437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608437">(Aug 06 2021 at 13:13)</a>:</h4>
<p>by using one value in one case and another value in another case, e.g. causing us to end up with 2 different assoc types for the same type</p>



<a name="248608819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608819">(Aug 06 2021 at 13:16)</a>:</h4>
<p>Ok, but if the guarantee can be checked via the valtree approach</p>



<a name="248608950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608950">(Aug 06 2021 at 13:17)</a>:</h4>
<p>Maybe just use valtree approach as the "regular result" and emit warnings and errors when the const impls of PartialEq and Eq "cheats"?</p>



<a name="248608984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248608984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248608984">(Aug 06 2021 at 13:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248605974">said</a>:</p>
<blockquote>
<p>it would be unsound to treat a const in a pattern like a valtree but later call <code>PartialEq::eq</code> at runtime.</p>
</blockquote>
<p>yeah, but doing that seems really undesirable to me which is my reason why I don't think we should make it <code>unsafe</code></p>



<a name="248609173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609173">(Aug 06 2021 at 13:19)</a>:</h4>
<p>I don't think we ever <strong>want</strong> to do that, nor do i expect us to accidentally do that due to some bug or sth</p>



<a name="248609200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609200">(Aug 06 2021 at 13:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248590533">said</a>:</p>
<blockquote>
<p>I'd be fine declaring that const-&gt;pat is not the same as runtime equality if the user declares this explicitly, but I want eager conversion to valtrees so we don't have to maintain two systems for deconstructing constants (one for generating valtrees, one for taking apart <code>ConstValue</code> allocations)</p>
</blockquote>
<p>So I think this is the big difference between our proposals. Keeping the best-effort scheme that deconstructs all kinds of constants as far as possible, vs generating a valtree, if that fails, do an opaque comparison, if it succeeds, infallibly convert to a pattern</p>



<a name="248609208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609208">(Aug 06 2021 at 13:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248609173">said</a>:</p>
<blockquote>
<p>I don't think we ever <strong>want</strong> to do that, nor do i expect us to accidentally do that due to some bug or sth</p>
</blockquote>
<p>same</p>



<a name="248609274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609274">(Aug 06 2021 at 13:19)</a>:</h4>
<p>the logic is such as that you either deconstruct, or you generate an opaque constant</p>



<a name="248609351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609351">(Aug 06 2021 at 13:20)</a>:</h4>
<p>you can't have something deconstructable that generates an opaque constant</p>



<a name="248609491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609491">(Aug 06 2021 at 13:21)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248609200">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248590533">said</a>:</p>
<blockquote>
<p>I'd be fine declaring that const-&gt;pat is not the same as runtime equality if the user declares this explicitly, but I want eager conversion to valtrees so we don't have to maintain two systems for deconstructing constants (one for generating valtrees, one for taking apart <code>ConstValue</code> allocations)</p>
</blockquote>
<p>So I think this is the big difference between our proposals. Keeping the best-effort scheme that deconstructs all kinds of constants as far as possible, vs generating a valtree, if that fails, do an opaque comparison, if it succeeds, infallibly convert to a pattern</p>
</blockquote>
<p>yes (though from a backcompat perspective these two things are actually equivalent)</p>



<a name="248609617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609617">(Aug 06 2021 at 13:22)</a>:</h4>
<p>though my proposal results in more helpful warnings :p so it's better uwu</p>



<a name="248609792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248609792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248609792">(Aug 06 2021 at 13:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span>  "cheats" would mean "returns true but can be differentiated somehow". I don't think it's possible to statically assert that 2 different values do not result in some different result somewhere</p>



<a name="248610462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248610462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248610462">(Aug 06 2021 at 13:28)</a>:</h4>
<p>For impl selection, comparison must be performed? By generating a valtree, comparing its structure and leaf nodes bit representation to another valtree, or something like this.</p>



<a name="248611221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248611221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248611221">(Aug 06 2021 at 13:34)</a>:</h4>
<p>I'm imaging use cases like this:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="k">const</span><span class="w"> </span><span class="n">S</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">str</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="s">"hello"</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">     </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="fm">unreachable!</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="s">"world"</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">     </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Foo</span>::<span class="o">&lt;</span><span class="s">"world"</span><span class="o">&gt;</span>::<span class="n">foo</span><span class="p">();</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248611698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248611698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248611698">(Aug 06 2021 at 13:38)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116458">Charles Lew</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248611221">said</a>:</p>
<blockquote>
<p>I'm imaging use cases like this:</p>
</blockquote>
<p>that will work using structural equality/val trees</p>
<p>i don't fully understand  your first question <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> But yes, to know whether an impl applies you have to compare any const parameters, which we want to do by comparing their val trees (and currently do in a fragile way by destructuring their allocation)</p>



<a name="248612033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248612033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248612033">(Aug 06 2021 at 13:41)</a>:</h4>
<p>I split this into 2 traits because:</p>
<ul>
<li>I want to destructure values as much as possible to get better warnings and code which is easier to optimize</li>
</ul>



<a name="248612130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248612130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248612130">(Aug 06 2021 at 13:41)</a>:</h4>
<ul>
<li>verifying that the shallow notion of structural equality holds is pretty much trivial while doing it for the deep one is not</li>
</ul>



<a name="248612460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248612460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248612460">(Aug 06 2021 at 13:44)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248612130">said</a>:</p>
<blockquote>
<ul>
<li>verifying that the shallow notion of structural equality holds is pretty much trivial while doing it for the deep one is not</li>
</ul>
</blockquote>
<p>I thought we'd just need to throw <code>StructuralEq</code> bounds for the field's types on the generated impl of <code>StructuralEq</code>?</p>



<a name="248612471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248612471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248612471">(Aug 06 2021 at 13:44)</a>:</h4>
<p>(I do believe that it's necessary to allow the user to manually assert that their type uses structural equality, e.g. when using some <code>PhantomData</code> which means that they can't use the derived <code>PartialEq</code>)</p>



<a name="248612506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248612506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Charles Lew <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248612506">(Aug 06 2021 at 13:44)</a>:</h4>
<p>I just want to say maybe user annotation(<code>StructuralEq</code>) is not that necessary for const generic use case... Maybe the intention may be better expressed with something like <code>impl const PartialEq</code> or something.</p>



<a name="248612801"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248612801" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248612801">(Aug 06 2021 at 13:47)</a>:</h4>
<p>yes, I wanted to ex<br>
<span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248612460">said</a>:</p>
<blockquote>
<p>I thought we'd just need to throw <code>StructuralEq</code> bounds for the field's types on the generated impl of <code>StructuralEq</code>?</p>
</blockquote>
<p>wanted to expand on that rn <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span>  yes, when the user implements <code>StructuralEq</code> the compiler could check that all fields implement <code>StructuralEq</code>, error, and recommend the potentially missing generic bounds</p>



<a name="248613145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613145">(Aug 06 2021 at 13:50)</a>:</h4>
<p>oh heh... <em>that</em> is what you mean</p>



<a name="248613173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613173">(Aug 06 2021 at 13:50)</a>:</h4>
<p>doing that is <em>bad</em> though</p>



<a name="248613179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613179">(Aug 06 2021 at 13:50)</a>:</h4>
<p>yea I don't care about user defined impls, if they screw them up, they get weird errors and behaviour, and we can add lints and other helpers, but that is just nice, not necessary for the "recursive" feature</p>



<a name="248613230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613230">(Aug 06 2021 at 13:51)</a>:</h4>
<p>like, structural eq is kinda boring as a trait, so there probably won't be weird bounds or sth</p>



<a name="248613287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613287">(Aug 06 2021 at 13:51)</a>:</h4>
<p>if your type implements <code>StructuralEq</code> we assume it can be destructured recursively all the way</p>



<a name="248613365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613365">(Aug 06 2021 at 13:52)</a>:</h4>
<p>but we still have the issue that if your type depend on some other crate, you first have to update that crate to implement <code>StructuralEq</code> for your type</p>



<a name="248613392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613392">(Aug 06 2021 at 13:52)</a>:</h4>
<p>you may have complex bounds if field types are associated types of generic parameters</p>



<a name="248613477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613477">(Aug 06 2021 at 13:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248613365">said</a>:</p>
<blockquote>
<p>but we still have the issue that if your type depend on some other crate, you first have to update that crate to implement <code>StructuralEq</code> for your type</p>
</blockquote>
<p>if you implement it without your fields actually having a <code>StructuralEq</code> impl, you are asserting that they are, with all the semver and similar issues that implies</p>



<a name="248613497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613497">(Aug 06 2021 at 13:53)</a>:</h4>
<p>that is fine imo</p>



<a name="248613633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613633">(Aug 06 2021 at 13:54)</a>:</h4>
<blockquote>
<p>you are asserting that they are</p>
</blockquote>
<p>but they aren't? If your field doesn't implement <code>StructuralEq</code> and <code>StructuralEq</code> impls are "deep", that doesn#t seem to work?</p>



<a name="248613723"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613723" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613723">(Aug 06 2021 at 13:54)</a>:</h4>
<p>well... we don't need the trait to deconstruct values of the type. We need the trait in order to do so without PME</p>



<a name="248613732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613732">(Aug 06 2021 at 13:55)</a>:</h4>
<p>or like, do you then assert: Hey my field might not be <code>StructuralEq</code>, but I've looked at it and it seems to fulfill these requirements. Causing bugs if the crate I use later changes their <code>PartialEq</code> impl</p>



<a name="248613791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613791">(Aug 06 2021 at 13:55)</a>:</h4>
<p>yea, pretty much. I mean what other option do we have?</p>



<a name="248613797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613797">(Aug 06 2021 at 13:55)</a>:</h4>
<p>that does require you to look at your fields</p>



<a name="248613841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613841">(Aug 06 2021 at 13:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248613791">said</a>:</p>
<blockquote>
<p>yea, pretty much. I mean what other option do we have?</p>
</blockquote>
<p>shallow <code>StructuralEq</code> :p (<code>StructuralMatch</code> in my proposal)</p>



<a name="248613937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613937">(Aug 06 2021 at 13:56)</a>:</h4>
<p>with deep <code>StructuralEq</code> automatically implemented by the compiler</p>



<a name="248613956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248613956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248613956">(Aug 06 2021 at 13:56)</a>:</h4>
<p>ok hold up, we're going in circles</p>



<a name="248614431"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248614431" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248614431">(Aug 06 2021 at 14:00)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248613791">said</a>:</p>
<blockquote>
<p>yea, pretty much. I mean what other option do we have?</p>
</blockquote>
<p>then I guess, what other option for which issue exactly? <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="248614451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248614451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248614451">(Aug 06 2021 at 14:00)</a>:</h4>
<p>I believe we all agree that we need to be able to convert constants to valtrees for const generics. Now, my current view is that we want to guarantee this works by having a trait (<code>StructuralEq</code>) on types that say "this type satsifies this". It has nothing to do with <code>PartialEq</code>, but it is nice if the behaviour matches. If the user manually implements <code>StructuralEq</code> and the valtree conversion fails, then you get a PME. We could prevent the PME, but that would require the compiler to check the <code>StructuralEq</code> correctness. The user may have a <code>struct IsJustAnInt(*const i32)</code> that they are sure will never contain pointers, so they impl <code>StructuralEq</code> for it. the static compiler check would fail, but valtree conversion would work</p>



<a name="248614504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248614504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248614504">(Aug 06 2021 at 14:00)</a>:</h4>
<p>I believe most of our disagreements/confusion/circles come from pattern matching</p>



<a name="248614986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248614986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248614986">(Aug 06 2021 at 14:04)</a>:</h4>
<p>In patterns, if the user "lied" with their manual <code>StructuralEq</code> impl, we will get behaviour changes where a constant that gets destructured does <em>not</em> behave like the <code>PartialEq</code> impl. We also need to maintain the current infrastructure for partially taking apart constants until we can't anymore due to <code>!StructuralEq</code> things.</p>



<a name="248615679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248615679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248615679">(Aug 06 2021 at 14:10)</a>:</h4>
<p>The compiler can aggressively deconstruct constants to values without caring about <code>StructuralEq</code> in two ways: </p>
<ol>
<li>convert to valtree, then to pattern or if conversion failed, fall back to <code>PartialEq</code> and </li>
<li>deconstruct the constant level by level as far as possible, fall back to <code>PartialEq</code> once not possible, error if no <code>PartialEq</code> impl</li>
</ol>
<p>these both have some problems</p>
<ol>
<li>has the problem that it falls back to <code>PartialEq</code> even if we could do some partial deconstruction and thus get nicer exhaustiveness handling</li>
<li>has the problem that we need to keep the allocation based const deconstructor and depending on values of "as far as possible", we may change the behaviour when compared to <code>PartialEq</code></li>
</ol>



<a name="248616445"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248616445" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248616445">(Aug 06 2021 at 14:16)</a>:</h4>
<blockquote>
<p>We could prevent the PME</p>
</blockquote>
<p>strongly believe s/could/should.</p>
<blockquote>
<p>The user may have a <code>struct IsJustAnInt(*const i32)</code></p>
</blockquote>
<p>uh, i don't like that <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span>   I understand why that would work, but having a val tree node of type <code>*const i32</code>, even if it was created using <code>2 as *const i32</code> seems weird.</p>
<p>But yes, I agree with that summary for const generics <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="248616547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248616547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248616547">(Aug 06 2021 at 14:17)</a>:</h4>
<p>ok, so... you say we should validate that the manual impl could have been defined recursively?</p>



<a name="248616667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248616667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248616667">(Aug 06 2021 at 14:18)</a>:</h4>
<blockquote>
<p>We also need to maintain the current infrastructure for partially taking apart constants until we can't anymore due to <code>!StructuralEq</code> things.</p>
</blockquote>
<p>not necessarily, do we? If implementing <code>StructuralEq</code> is a proof that the value can be fully converted to a val tree this wouldn't be the case, would it? If we just use <code>PartialEq</code></p>



<a name="248616793"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248616793" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248616793">(Aug 06 2021 at 14:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248616547">said</a>:</p>
<blockquote>
<p>ok, so... you say we should validate that the manual impl could have been defined recursively?</p>
</blockquote>
<p>We should only allow types in constants if the compiler knows that all values of that type are a representable as a val tree. I didn't yet think about how that should work if we only have 1 trait. With 2 traits that feels straightforward</p>



<a name="248617010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617010">(Aug 06 2021 at 14:21)</a>:</h4>
<p>what does PME stand for?</p>



<a name="248617024"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617024" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617024">(Aug 06 2021 at 14:21)</a>:</h4>
<p>post monomorphization error</p>



<a name="248617032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617032">(Aug 06 2021 at 14:21)</a>:</h4>
<p>thanks</p>



<a name="248617143"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617143" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617143">(Aug 06 2021 at 14:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248606522">said</a>:</p>
<blockquote>
<p>"breaks the language" already kind of happens when hash/eq disagree, or when deref is not reliably returning the same thing</p>
</blockquote>
<p>to be clear: We don’t require that the relevant traits in these cases are <code>unsafe</code> either, for better or for worse. Right?</p>



<a name="248617180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617180">(Aug 06 2021 at 14:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248616667">said</a>:</p>
<blockquote>
<blockquote>
<p>We also need to maintain the current infrastructure for partially taking apart constants until we can't anymore due to <code>!StructuralEq</code> things.</p>
</blockquote>
<p>not necessarily, do we? If implementing <code>StructuralEq</code> is a proof that the value can be fully converted to a val tree this wouldn't be the case, would it? If we just use <code>PartialEq</code></p>
</blockquote>
<p>this is option 2 for patterns, which you didn't want, because we have less useful exhaustiveness stuff</p>



<a name="248617257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617257">(Aug 06 2021 at 14:23)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248617143">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248606522">said</a>:</p>
<blockquote>
<p>"breaks the language" already kind of happens when hash/eq disagree, or when deref is not reliably returning the same thing</p>
</blockquote>
<p>to be clear: We don’t require that the relevant traits in these cases are <code>unsafe</code> either, for better or for worse. Right?</p>
</blockquote>
<p>Ralf had an argument for making <code>StructuralEq</code> unsafe, but lcnr and I don't share his view XD And he later admitted we could avoid making <code>StructuralEq</code> unsafe</p>



<a name="248617323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617323">(Aug 06 2021 at 14:23)</a>:</h4>
<p>Ralf was arguing that <code>Eq</code>, <code>Hash</code>, and <code>Deref</code>/<code>DerefMut</code> should be made <code>unsafe trait</code> ?</p>



<a name="248617406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617406">(Aug 06 2021 at 14:24)</a>:</h4>
<p>(its definitely a debate that we’ve gone through in the past. I just figured that ship has sailed at this point.)</p>



<a name="248617417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617417">(Aug 06 2021 at 14:24)</a>:</h4>
<p>no, that was me saying since they aren't unsafe, neither does <code>StructuralEq</code> need to be</p>



<a name="248617430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617430">(Aug 06 2021 at 14:24)</a>:</h4>
<p>it's not a safety thing</p>



<a name="248617434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617434">(Aug 06 2021 at 14:24)</a>:</h4>
<p>it's just surprising</p>



<a name="248617448"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617448" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617448">(Aug 06 2021 at 14:24)</a>:</h4>
<p>okay. Yes.</p>



<a name="248617522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617522">(Aug 06 2021 at 14:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248616793">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248616547">said</a>:</p>
<blockquote>
<p>ok, so... you say we should validate that the manual impl could have been defined recursively?</p>
</blockquote>
<p>We should only allow types in constants if the compiler knows that all values of that type are a representable as a val tree. I didn't yet think about how that should work if we only have 1 trait. With 2 traits that feels straightforward</p>
</blockquote>
<p>I thought we only needed two traits to have the shallow <code>StructuralMatch</code> for patterns?</p>



<a name="248617525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617525">(Aug 06 2021 at 14:25)</a>:</h4>
<div class="spoiler-block"><div class="spoiler-header">
</div><div class="spoiler-content" aria-hidden="true">
<p>it is a safety thing, if <code>StructuralEq</code> were an unsafe trait, you could use that knowledge during sorting or something to know that the impl is deterministic :p</p>
</div></div>



<a name="248617545"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617545" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617545">(Aug 06 2021 at 14:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248617257">said</a>:</p>
<blockquote>
<p>Ralf had an argument for making them unsafe, but lcnr and I don't share his view XD And he later addmitted we could avoid making them unsafe</p>
</blockquote>
<p>(the word “them” was and remains unclear to me in the above.)</p>



<a name="248617695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617695">(Aug 06 2021 at 14:26)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116083">pnkfelix</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248617545">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248617257">said</a>:</p>
<blockquote>
<p>Ralf had an argument for making them unsafe, but lcnr and I don't share his view XD And he later addmitted we could avoid making them unsafe</p>
</blockquote>
<p>(the word “them” was and remains unclear to me in the above.)</p>
</blockquote>
<p>fixed</p>



<a name="248617859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248617859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248617859">(Aug 06 2021 at 14:27)</a>:</h4>
<p>yes, <br>
<span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248617522">said</a>:</p>
<blockquote>
<p>I thought we only needed two traits to have the shallow <code>StructuralMatch</code> for patterns?</p>
</blockquote>
<p>that's the reason i started out with 2 traits, but a lot of my recent grumbling about structural equality used these 2 traits. So I figured out how to do it in this case. I don't think that 2 traits are necessary to know that val trees always work, but I know that 2 traits are good enough for that</p>



<a name="248618039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248618039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248618039">(Aug 06 2021 at 14:29)</a>:</h4>
<blockquote>
<p>this is option 2 for patterns, which you didn't want, because we have less useful exhaustiveness stuff</p>
</blockquote>
<p>yeah, was confused because that sentence was outside of the 2 different ways, so that's more of a formatting complaint</p>



<a name="248618540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248618540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248618540">(Aug 06 2021 at 14:33)</a>:</h4>
<p>so... all in all, modulo details that we are all flexible on, the question is whether we keep better exhaustiveness errors but also keep the deconstruction of constants, or whether we treat all constants that aren't <em>guaranteed</em> recursively <code>StructuralEq</code> as opaque and thus lose some exhaustivness quality.</p>



<a name="248618607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248618607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248618607">(Aug 06 2021 at 14:33)</a>:</h4>
<blockquote>
<p>has the problem that we need to keep the allocation based const deconstructor</p>
</blockquote>
<p>I don't know how much of a pain supporting a partial val tree conversion is. That's something you've implemented. In case it is annoying I don't mind going with your proposal as long as we</p>
<ul>
<li>prevent types from being structural eq which have valid values which are not convertable to a val tree</li>
<li>allow users to manually assert that structural equality can be used without requiring <code>unsafe</code></li>
</ul>
<p>i think we (<del>me and</del> <span class="user-mention" data-user-id="124288">@oli</span> <em>and me</em><span aria-label="sparkles" class="emoji emoji-2728" role="img" title="sparkles">:sparkles:</span>) pretty much agree on the rest already <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="248618935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248618935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248618935">(Aug 06 2021 at 14:36)</a>:</h4>
<p>it is somewhat annoying to keep around. There are two queries (deref and destructure), which we don't want anyone to use except for const_to_pat</p>



<a name="248618990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248618990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248618990">(Aug 06 2021 at 14:37)</a>:</h4>
<p>valtree duplicates that logic, and it is hard to share stuff between them, but we could share a bit more</p>



<a name="248620832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248620832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248620832">(Aug 06 2021 at 14:53)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248613477">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248613365">said</a>:</p>
<blockquote>
<p>but we still have the issue that if your type depend on some other crate, you first have to update that crate to implement <code>StructuralEq</code> for your type</p>
</blockquote>
<p>if you implement it without your fields actually having a <code>StructuralEq</code> impl, you are asserting that they are, with all the semver and similar issues that implies</p>
</blockquote>
<p>i also don't want to allow this ^^ and with this I am happy with structural equality for the first time since knowing about it</p>



<a name="248621214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248621214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248621214">(Aug 06 2021 at 14:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248612033">said</a>:</p>
<blockquote>
<p>I split this into 2 traits because:</p>
<ul>
<li>I want to destructure values as much as possible to get better warnings and code which is easier to optimize</li>
</ul>
</blockquote>
<p>why do you think this will lead to better warnings or code that is easier to optimize?</p>
<p>we <em>know</em> it will lead to a more complicated rustc (-&gt; more bugs) and more things to learn for users (2 traits). that outweighs the things you list IMO.</p>



<a name="248621358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248621358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248621358">(Aug 06 2021 at 14:58)</a>:</h4>
<p><del>what's a "PME"?</del></p>



<a name="248621786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248621786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248621786">(Aug 06 2021 at 15:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248617430">said</a>:</p>
<blockquote>
<p>it's not a safety thing<br>
it's just surprising</p>
</blockquote>
<p>surprising quickly leads to unsafety.<br>
also if you read my document there I discuss the angle of future compatibility: if we cant enforce requirements on <code>StructuralEq</code> then just adding an <code>impl StrucutralEq for T</code> can change the behavior of existing code without any warning or so. So basically adding that impl becomes a breaking change.</p>



<a name="248622177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248622177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248622177">(Aug 06 2021 at 15:04)</a>:</h4>
<blockquote>
<ul>
<li>prevent types from being structural eq which have valid values which are not convertable to a val tree</li>
<li>allow users to manually assert that structural equality can be used without requiring unsafe</li>
</ul>
</blockquote>
<p>I dont like either of that TBH.^^ I think there is a chance to establish a meaningful abstraction here and we should use it. But <code>StructuralEq</code> cant be a meaningful abstraction if it is safe.<br>
Also the "prevent" part basically means this would be like <code>Copy</code> -- the compiler double-checks that you are not implementing the trait in ways you are not supposed to. But the need for <code>unsafe impl Copy</code> is discussed every now and then. No need to repeat that story here. Sometimes the user needs this control, and I think we should give it to them.</p>



<a name="248622464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248622464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248622464">(Aug 06 2021 at 15:07)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248607941">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248607864">said</a>:</p>
<blockquote>
<p>are you suggesting we have two slightly different notions and have to explain both of them to everyone? that's a lot of extra complexity, and I see insufficient benefit from doing so.</p>
</blockquote>
<p>my suggestion is <a href="https://hackmd.io/-IB2BH1hSWWMQVSfbvVViA">https://hackmd.io/-IB2BH1hSWWMQVSfbvVViA</a></p>
</blockquote>
<p>wow that has 3 traits where I think 1 is enough. oO<br>
but I think you and oli made some progress, so did that change?</p>



<a name="248622949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248622949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248622949">(Aug 06 2021 at 15:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248618935">said</a>:</p>
<blockquote>
<p>it is somewhat annoying to keep around. There are two queries (deref and destructure), which we don't want anyone to use except for const_to_pat</p>
</blockquote>
<p>and they are messy, too... I think all of this <a href="https://github.com/rust-lang/rust/blob/1f94abcda6884893d4723304102089198caa0839/compiler/rustc_mir/src/const_eval/eval_queries.rs#L119">try_as_immediate</a> mess is just there to support old-skool const → pat conversion.</p>



<a name="248623015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623015">(Aug 06 2021 at 15:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248621214">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248612033">said</a>:</p>
<blockquote>
<p>I split this into 2 traits because:</p>
<ul>
<li>I want to destructure values as much as possible to get better warnings and code which is easier to optimize</li>
</ul>
</blockquote>
<p>why do you think this will lead to better warnings or code that is easier to optimize?</p>
<p>we <em>know</em> it will lead to a more complicated rustc (-&gt; more bugs) and more things to learn for users (2 traits). that outweighs the things you list IMO.</p>
</blockquote>
<p>better warnings: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796</a></p>
<p>code that is easier to optimize: we can destructure more constants which means we have more stuff which does not call <code>PartialEq</code>(which is opaque for optimizations)</p>
<blockquote>
<p>more things to learn for users (2 traits)</p>
</blockquote>
<p>I am doubtful that this is necessarily true, 2 simple traits are better than one complex one.</p>



<a name="248623190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623190">(Aug 06 2021 at 15:12)</a>:</h4>
<blockquote>
<p>better warnings: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796</a></p>
</blockquote>
<p>if this uses <code>PartialEq</code> comparison, the 2nd arm actually is reachable with "evil" implementations...</p>



<a name="248623230"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623230" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623230">(Aug 06 2021 at 15:13)</a>:</h4>
<blockquote>
<p>code that is easier to optimize: we can destructure more constants which means we have more stuff which does not call PartialEq(which is opaque for optimizations)</p>
</blockquote>
<p>it's usually available for inlining. I'm sorry I wont believe this claim without benchmarks. also I think we can find better ways to improve perf here if it is needed; ways that do not introduce extra complexity onto our users.</p>



<a name="248623418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623418">(Aug 06 2021 at 15:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248623190">said</a>:</p>
<blockquote>
<blockquote>
<p>better warnings: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796</a></p>
</blockquote>
<p>this uses <code>PartialEq</code> comparison, the 2nd arm actually is reachable with "evil" implementations...</p>
</blockquote>
<p>no? the first branch is an actual pattern which are always treated as, well, a pattern</p>



<a name="248623427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623427">(Aug 06 2021 at 15:14)</a>:</h4>
<blockquote>
<p>I am doubtful that this is necessarily true, 2 simple traits are better than one complex one.</p>
</blockquote>
<p>it's 1 simple trait though. ;) well that's subjective but you literally also have a <code>StructuralEq</code> trait with, as far as I can say, the same basic semantics. so if your 2 traits are simple then my 1 trait is definitely simple.</p>



<a name="248623454"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623454" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623454">(Aug 06 2021 at 15:14)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248623418">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248623190">said</a>:</p>
<blockquote>
<blockquote>
<p>better warnings: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796</a></p>
</blockquote>
<p>this uses <code>PartialEq</code> comparison, the 2nd arm actually is reachable with "evil" implementations...</p>
</blockquote>
<p>no?</p>
</blockquote>
<p>sorry I meant to say "<em>if</em> this uses <code>PartialEq</code> comparison"</p>



<a name="248623464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623464">(Aug 06 2021 at 15:14)</a>:</h4>
<p>which I guess it does? for the 2nd field</p>



<a name="248623476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623476">(Aug 06 2021 at 15:14)</a>:</h4>
<p>since destructuring will fail?</p>



<a name="248623729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623729">(Aug 06 2021 at 15:16)</a>:</h4>
<p>for the first branch to not get triggered here, no matter what trait <code>Foo</code> implements is a breaking change, isn't it?</p>



<a name="248623813"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623813" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623813">(Aug 06 2021 at 15:17)</a>:</h4>
<p>I was imagining a <code>impl PartialEq for NonStructuralEq</code> that returns <code>false</code> on the first call and <code>true</code> on the 2nd</p>



<a name="248623858"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623858" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623858">(Aug 06 2021 at 15:17)</a>:</h4>
<p>but this match doesn'T care about <code>NonStructuralEq</code> at all?</p>



<a name="248623879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623879">(Aug 06 2021 at 15:17)</a>:</h4>
<p>...?</p>



<a name="248623885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248623885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248623885">(Aug 06 2021 at 15:17)</a>:</h4>
<p>it uses a wildcard</p>



<a name="248624104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624104">(Aug 06 2021 at 15:19)</a>:</h4>
<p>well no matter what you do you'll not always be consistent with the <code>PartialEq</code> impl</p>



<a name="248624113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624113">(Aug 06 2021 at 15:19)</a>:</h4>
<p>so matching needs its completely separate complicated set of rules</p>



<a name="248624269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624269">(Aug 06 2021 at 15:20)</a>:</h4>
<p>i think non constant patterns are always structural?</p>



<a name="248624284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624284">(Aug 06 2021 at 15:20)</a>:</h4>
<p>i don't think that's changeable</p>



<a name="248624368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624368">(Aug 06 2021 at 15:21)</a>:</h4>
<p>matching against <code>FOO</code> should behave the same as inlining <code>FOO</code> there</p>



<a name="248624375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624375">(Aug 06 2021 at 15:21)</a>:</h4>
<p>that's the <em>definition</em> of <code>const</code></p>



<a name="248624398"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624398" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624398">(Aug 06 2021 at 15:21)</a>:</h4>
<p>it acts as if the definition was inlined everywhere</p>



<a name="248624435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624435">(Aug 06 2021 at 15:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248624375">said</a>:</p>
<blockquote>
<p>that's the <em>definition</em> of <code>const</code></p>
</blockquote>
<p><em>simplified definition</em></p>



<a name="248624508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624508">(Aug 06 2021 at 15:22)</a>:</h4>
<p>because it definitely does not act that way</p>



<a name="248624556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624556">(Aug 06 2021 at 15:22)</a>:</h4>
<p>well <a href="https://github.com/rust-lang/const-eval/blob/master/const.md">not simplified by a lot</a></p>



<a name="248624604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624604">(Aug 06 2021 at 15:23)</a>:</h4>
<p>that's for terms, not patterns, of course</p>



<a name="248624624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624624">(Aug 06 2021 at 15:23)</a>:</h4>
<p>this compiles</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">NonStructuralEq</span><span class="p">(</span><span class="kt">bool</span><span class="p">);</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="nb">PartialEq</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">NonStructuralEq</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">eq</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="kp">&amp;</span><span class="nc">Self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">bool</span> <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kc">false</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="cp">#[derive(PartialEq)]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">value</span>: <span class="kt">bool</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">other</span>: <span class="nc">NonStructuralEq</span><span class="p">,</span><span class="w"></span>

<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">FOO</span>: <span class="nc">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span>: <span class="nc">true</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="nc">NonStructuralEq</span><span class="p">(</span><span class="kc">true</span><span class="p">)</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">FOO</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span>: <span class="nc">true</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="nc">_</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">value</span>: <span class="nc">false</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="nc">_</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248624636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624636">(Aug 06 2021 at 15:23)</a>:</h4>
<p>but IMO the same should be true for patterns</p>



<a name="248624687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624687">(Aug 06 2021 at 15:23)</a>:</h4>
<p>yes, so? that's just using <code>FOO</code> as a term...?</p>



<a name="248624746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624746">(Aug 06 2021 at 15:24)</a>:</h4>
<p>you cannot allow the usage of <code>PartialEq</code> for constants in patterns while also requiring constants to behave in the same way as if they were written inline</p>



<a name="248624795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624795">(Aug 06 2021 at 15:24)</a>:</h4>
<p>you can't put <code>_</code> into a const</p>



<a name="248624804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624804">(Aug 06 2021 at 15:24)</a>:</h4>
<p>so I think you are wrong</p>



<a name="248624849"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624849" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624849">(Aug 06 2021 at 15:24)</a>:</h4>
<p>this is not what I am saying</p>



<a name="248624929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624929">(Aug 06 2021 at 15:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248623190">said</a>:</p>
<blockquote>
<blockquote>
<p>better warnings: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796</a></p>
</blockquote>
<p>if this uses <code>PartialEq</code> comparison, the 2nd arm actually is reachable with "evil" implementations...</p>
</blockquote>
<p>please reconsider that statement, which is what I am talking about here</p>



<a name="248624961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248624961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248624961">(Aug 06 2021 at 15:25)</a>:</h4>
<p>your example doesnt demonstrate your claim.<br>
this pattern is rightfully rejected: <code>Foo { value: true, other: NonStructuralEq(true) }</code></p>



<a name="248625027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625027">(Aug 06 2021 at 15:26)</a>:</h4>
<p>that's what inlining <code>FOO</code> would give you</p>



<a name="248625060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625060">(Aug 06 2021 at 15:26)</a>:</h4>
<p>so we currently cant even compare the two alternatives as one doesnt compile</p>



<a name="248625134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625134">(Aug 06 2021 at 15:27)</a>:</h4>
<p>this is because there are conflicting expectations -- when you write explicit literals you expect field-by-field matching; when you write a <code>const</code> you might expect <code>PartialEq</code> comparison. When they disagree we have a mess.</p>



<a name="248625570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625570">(Aug 06 2021 at 15:30)</a>:</h4>
<p>but if we allow (safe) <code>impl StructuralEq</code> then it's very easy for this mess to arise, and that mess can make it very hard to reason about what your code does (which is where safety comes in)</p>



<a name="248625668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625668">(Aug 06 2021 at 15:30)</a>:</h4>
<p>can we take a step back?</p>



<a name="248625694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625694">(Aug 06 2021 at 15:31)</a>:</h4>
<p>because there is a fundamental misunderstanding here and I don't know where exactly</p>



<a name="248625754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625754">(Aug 06 2021 at 15:31)</a>:</h4>
<ul>
<li>we want to allow constants in patterns using their <code>PartialEq</code> impl, even if they don't implement <code>StructuralEq</code>. or more accurately, pretty much agreed on that because of backcompat concerns</li>
</ul>



<a name="248625969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248625969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248625969">(Aug 06 2021 at 15:33)</a>:</h4>
<ul>
<li>currently explicit patterns use field-by-field /structural matching</li>
</ul>



<a name="248626471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248626471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248626471">(Aug 06 2021 at 15:36)</a>:</h4>
<p>do you want this to compile in the future?</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">NonStructuralEq</span><span class="p">(</span><span class="kt">bool</span><span class="p">);</span><span class="w"></span>
<span class="k">impl</span><span class="w"> </span><span class="nb">PartialEq</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">NonStructuralEq</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">eq</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="kp">&amp;</span><span class="nc">Self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">bool</span> <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kc">false</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="cp">#[derive(PartialEq)]</span><span class="w"></span>
<span class="k">struct</span> <span class="nc">Foo</span><span class="p">(</span><span class="n">NonStructuralEq</span><span class="p">);</span><span class="w"></span>
<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">FOO</span>: <span class="nc">Foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="p">(</span><span class="n">NonStructuralEq</span><span class="p">(</span><span class="kc">true</span><span class="p">));</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">FOO</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">FOO</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="248628003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248628003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248628003">(Aug 06 2021 at 15:47)</a>:</h4>
<hr>
<blockquote>
<p>Also the "prevent" part basically means this would be like Copy -- the compiler double-checks that you are not implementing the trait in ways you are not supposed to. But the need for unsafe impl Copy is discussed every now and then. No need to repeat that story here. Sometimes the user needs this control, and I think we should give it to them.</p>
</blockquote>
<p>No one wants <code>unsafe impl Sized</code> as far as I can tell. :p</p>
<p>I only want the compiler to prevent things which are known to not/never be valid val trees, e.g. extern types and pointers (ignoring int2ptr casts and what not, because imo we should not not use structural equality in that case). </p>
<hr>



<a name="248628706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248628706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248628706">(Aug 06 2021 at 15:52)</a>:</h4>
<p><del>guess we need shallow destructuring anyways</del> (or values which implement <code>StructuralEq</code> but have non val tree values, which afaict is something you want, and i really don't <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> )</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Sum</span><span class="p">(</span><span class="kt">u32</span><span class="p">,</span><span class="w"> </span><span class="kt">u32</span><span class="p">);</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="nb">PartialEq</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Sum</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">eq</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="kp">&amp;</span><span class="nc">Self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="kt">bool</span> <span class="p">{</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="mi">0</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="mi">1</span><span class="w"> </span><span class="o">==</span><span class="w"> </span><span class="n">other</span><span class="p">.</span><span class="mi">0</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">other</span><span class="p">.</span><span class="mi">1</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="nb">Eq</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Sum</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="cp">#[derive(PartialEq, Eq)]</span><span class="w"></span>
<span class="k">enum</span> <span class="nc">Eek</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">TheConst</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">UnusedByTheConst</span><span class="p">(</span><span class="n">Sum</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="n">THE_CONST</span>: <span class="nc">Eek</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Eek</span>::<span class="n">TheConst</span><span class="p">;</span><span class="w"></span>

<span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">Eek</span>::<span class="n">UnusedByTheConst</span><span class="p">(</span><span class="n">Sum</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">2</span><span class="p">))</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">THE_CONST</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="fm">println!</span><span class="p">(</span><span class="s">"Hello"</span><span class="p">);</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="n">Eek</span>::<span class="n">UnusedByTheConst</span><span class="p">(</span><span class="n">_</span><span class="p">)</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="fm">println!</span><span class="p">(</span><span class="s">"Gbye"</span><span class="p">);</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>
<p>edit: alright, I am back at my proposal of shallow and deep structural equality, i dislike ralfs notion that a type implementing <code>StructuralEq</code> may have values that are not representable using val trees, as long as all values of that type which can be represented as val trees have a <code>PartialEq</code> impl which agrees with valtree comparisons.</p>



<a name="248629346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248629346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248629346">(Aug 06 2021 at 15:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248622464">said</a>:</p>
<blockquote>
<p>wow that has 3 traits where I think 1 is enough. oO<br>
but I think you and oli made some progress, so did that change?</p>
</blockquote>
<p>project const generics has some open discussion about requiring some additional explicit opt in to allow your type as a const parameter type so that we don't add some new backcompat hazard there: <a href="https://github.com/rust-lang/project-const-generics/issues/6">https://github.com/rust-lang/project-const-generics/issues/6</a></p>



<a name="248629368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248629368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248629368">(Aug 06 2021 at 15:57)</a>:</h4>
<p>so that's the reason for the 3rd trait</p>



<a name="248629395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248629395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248629395">(Aug 06 2021 at 15:57)</a>:</h4>
<p>that one isn't too related to the rest of the structural match discussion</p>



<a name="248629938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248629938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248629938">(Aug 06 2021 at 16:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248621786">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248617430">said</a>:</p>
<blockquote>
<p>it's not a safety thing<br>
it's just surprising</p>
</blockquote>
<p>surprising quickly leads to unsafety.<br>
also if you read my document there I discuss the angle of future compatibility: if we cant enforce requirements on <code>StructuralEq</code> then just adding an <code>impl StrucutralEq for T</code> can change the behavior of existing code without any warning or so. So basically adding that impl becomes a breaking change.</p>
</blockquote>
<p>do you have a link here? I expected "my document" to mean your github summary but wasn't able to figure out what you meant wrt future compatibility. This is already an issue with auto ref specialization and stuff. And yes, when incorrectly implementing <code>StructuralEq</code> you can break some code in rare edge cases, but this shoud pretty much (i might even say will)  never happen.</p>



<a name="248631731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248631731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248631731">(Aug 06 2021 at 16:13)</a>:</h4>
<blockquote>
<p>do you want this to compile in the future?</p>
</blockquote>
<p>No. But I think it'd be reasonable if the user could add <code>unsafe impl StructuralEq for NonStructuralEq {}</code> and then it compiles.</p>



<a name="248631745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248631745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248631745">(Aug 06 2021 at 16:14)</a>:</h4>
<blockquote>
<p>No one wants unsafe impl Sized as far as I can tell. <span aria-label="p" class="emoji emoji-1f17f" role="img" title="p">:p:</span> </p>
</blockquote>
<p>fair. ;) but that's not really the same kind of thing.</p>



<a name="248631854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248631854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248631854">(Aug 06 2021 at 16:14)</a>:</h4>
<p>sizedness is inherently syntactic, <code>Copy</code> and <code>StructuralEq</code> are (or at least can be) semantic</p>



<a name="248631971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248631971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248631971">(Aug 06 2021 at 16:15)</a>:</h4>
<blockquote>
<p>i dislike ralfs notion that a type implementing StructuralEq may have values that are not representable using val trees, as long as all values of that type which can be represented as val trees have a PartialEq impl which agrees with valtree comparisons.</p>
</blockquote>
<p>that's just one of two very similar alternatives, and it is the one I like less</p>



<a name="248632027"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632027" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632027">(Aug 06 2021 at 16:16)</a>:</h4>
<p>the one I prefer is that a type implementing StructuralEq must have all of its values successfully convert to valtrees</p>



<a name="248632084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632084">(Aug 06 2021 at 16:16)</a>:</h4>
<p>the other one you quoted is just a clutch that could make <code>f32</code>/<code>f64</code> StructuralEq</p>



<a name="248632156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632156">(Aug 06 2021 at 16:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248629395">said</a>:</p>
<blockquote>
<p>that one isn't too related to the rest of the structural match discussion</p>
</blockquote>
<p>it seems related though... backcompat hazards apply to patterns as well</p>



<a name="248632225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632225">(Aug 06 2021 at 16:17)</a>:</h4>
<p>I guess in terms of backcompat it'd have been best if <code>StructuralEq</code> would have to be <code>derive</code>d explicitly</p>



<a name="248632414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632414">(Aug 06 2021 at 16:19)</a>:</h4>
<blockquote>
<p>do you have a link here? I expected "my document" to mean your github summary but wasn't able to figure out what you meant wrt future compatibility. This is already an issue with auto ref specialization and stuff. And yes, when incorrectly implementing StructuralEq you can break some code in rare edge cases, but this shoud pretty much (i might even say will) never happen.</p>
</blockquote>
<p>sorry, I meant <a href="https://hackmd.io/Qvrj_eOFTkCHZrhJ7f1ItA">https://hackmd.io/Qvrj_eOFTkCHZrhJ7f1ItA</a></p>



<a name="248632428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632428">(Aug 06 2021 at 16:19)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248631731">said</a>:</p>
<blockquote>
<blockquote>
<p>do you want this to compile in the future?</p>
</blockquote>
<p>No. But I think it'd be reasonable if the user could add <code>unsafe impl StructuralEq for NonStructuralEq {}</code> and then it compiles.</p>
</blockquote>
<p>wait, don't you want the second option for patterns from <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=277e02bb19cf25cea62922b610807484">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=277e02bb19cf25cea62922b610807484</a>?</p>



<a name="248632464"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632464" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632464">(Aug 06 2021 at 16:19)</a>:</h4>
<blockquote>
<p>but this shoud pretty much (i might even say will) never happen.</p>
</blockquote>
<p>I'd say the same about the code where your better warnings kick in, though ;)</p>



<a name="248632556"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632556" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632556">(Aug 06 2021 at 16:20)</a>:</h4>
<p>"the second option"?</p>



<a name="248632569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632569">(Aug 06 2021 at 16:20)</a>:</h4>
<p><a href="https://hackmd.io/Zrk3iPzOQDC5kOMC1B34_Q#Pattern-matching-on-constants">https://hackmd.io/Zrk3iPzOQDC5kOMC1B34_Q#Pattern-matching-on-constants</a> 2.</p>



<a name="248632617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632617">(Aug 06 2021 at 16:20)</a>:</h4>
<p>my preferred option is not on that list</p>



<a name="248632621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632621">(Aug 06 2021 at 16:21)</a>:</h4>
<p>but it's similar to 2 I think</p>



<a name="248632665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632665">(Aug 06 2021 at 16:21)</a>:</h4>
<p>it's: check if the type implements <code>StructuralEq</code>, if yes create valtree and proceed, else treat opaquely</p>



<a name="248632687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632687">(Aug 06 2021 at 16:21)</a>:</h4>
<ol>
<li>we have a bunch of future compat warnings or even no warning at all, where there is some non structural match type in a const in a pattern.</li>
</ol>



<a name="248632782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632782">(Aug 06 2021 at 16:22)</a>:</h4>
<ol start="2">
<li>we can't turn all of those into hard errors (which is why we decided against the third option here afaict)</li>
</ol>



<a name="248632884"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632884" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632884">(Aug 06 2021 at 16:22)</a>:</h4>
<ol start="3">
<li>you don't want this <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248626471">this</a> to compile</li>
</ol>



<a name="248632979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248632979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248632979">(Aug 06 2021 at 16:23)</a>:</h4>
<p>wait sorry</p>



<a name="248633078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633078">(Aug 06 2021 at 16:24)</a>:</h4>
<p>there's like a bazillion proposals here and what I want is not always what we can get with backcompat in mind ;)</p>



<a name="248633218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633218">(Aug 06 2021 at 16:25)</a>:</h4>
<p>if the consensus is that we do want to allow constants of non-strucutral-eq types in patterns (because we cant take that back -- did we crater this?), then your example will compile of course. I dont necessarily <em>want</em> this but I guess I have to live with it.^^</p>



<a name="248633225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633225">(Aug 06 2021 at 16:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248632665">said</a>:</p>
<blockquote>
<p>it's: check if the type implements <code>StructuralEq</code>, if yes create valtree and proceed, else treat opaquely</p>
</blockquote>
<p>that's exactly option 2</p>



<a name="248633259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633259">(Aug 06 2021 at 16:25)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248633225">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248632665">said</a>:</p>
<blockquote>
<p>it's: check if the type implements <code>StructuralEq</code>, if yes create valtree and proceed, else treat opaquely</p>
</blockquote>
<p>that's exactly option 2</p>
</blockquote>
<p>not really, option 2 doesnt involve StrucutralEq at all</p>



<a name="248633301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633301">(Aug 06 2021 at 16:25)</a>:</h4>
<p>well... the derives imply that</p>



<a name="248633397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633397">(Aug 06 2021 at 16:26)</a>:</h4>
<p>you are presupposing things about a trait where 3 people have 4 opinions on how and when it should be implementable or derived implicitly^^</p>



<a name="248633468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633468">(Aug 06 2021 at 16:26)</a>:</h4>
<p>that's why I didn't add the trait</p>



<a name="248633481"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633481" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633481">(Aug 06 2021 at 16:26)</a>:</h4>
<p>and mentioned exactly what I mean</p>



<a name="248633543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633543">(Aug 06 2021 at 16:27)</a>:</h4>
<p>right and that's why there is a (small) difference</p>



<a name="248633546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633546">(Aug 06 2021 at 16:27)</a>:</h4>
<p>not even the ability to let users stably use <code>StructuralEq</code> at all</p>



<a name="248633598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633598">(Aug 06 2021 at 16:27)</a>:</h4>
<p>since under my proposal, someone can do <code>unsafe impl StrucutralEq</code> and then it would (try to) cosntruct a valtree, and hard error (PME) if that fails</p>



<a name="248633628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633628">(Aug 06 2021 at 16:27)</a>:</h4>
<p>sure</p>



<a name="248633650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633650">(Aug 06 2021 at 16:28)</a>:</h4>
<p>but that is possible in the future with my proposal</p>



<a name="248633695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633695">(Aug 06 2021 at 16:28)</a>:</h4>
<p>indeed</p>



<a name="248633774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633774">(Aug 06 2021 at 16:28)</a>:</h4>
<p>there's the obvious variant of my proposal where we dont (yet) allow the user to write <code>unsafe impl StrucutralEq</code></p>



<a name="248633833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248633833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248633833">(Aug 06 2021 at 16:29)</a>:</h4>
<p>and then it coincides with one of your proposals I think</p>



<a name="248634326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634326">(Aug 06 2021 at 16:32)</a>:</h4>
<p>can you edit in your extension as a sub bullet of option 2?</p>



<a name="248634480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634480">(Aug 06 2021 at 16:33)</a>:</h4>
<p>"affects exhaustiveness warnings" it only affects dead arm warnings, right?</p>



<a name="248634497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634497">(Aug 06 2021 at 16:33)</a>:</h4>
<p>exhaustiveness is a hard error, not a warning...</p>



<a name="248634623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634623">(Aug 06 2021 at 16:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248634326">said</a>:</p>
<blockquote>
<p>can you edit in your extension as a sub bullet of option 2?</p>
</blockquote>
<p>done</p>



<a name="248634693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634693">(Aug 06 2021 at 16:34)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248634480">said</a>:</p>
<blockquote>
<p>"affects exhaustiveness warnings" it only affects dead arm warnings, right?</p>
</blockquote>
<p>there are no exhaustiveness warnings <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> yes, warnings that an arm is not needed for exhaustiveness</p>



<a name="248634809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634809">(Aug 06 2021 at 16:35)</a>:</h4>
<p>exhaustiveness figures out the dead arm, and then that warns, so yea</p>



<a name="248634839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634839">(Aug 06 2021 at 16:36)</a>:</h4>
<p>everyone is correct, only I am using the wrong words again <span aria-label="stuck out tongue" class="emoji emoji-1f61b" role="img" title="stuck out tongue">:stuck_out_tongue:</span></p>



<a name="248634890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634890">(Aug 06 2021 at 16:36)</a>:</h4>
<p>yeah I know the code is shared between exhaustiveness analysis and dead arm warnings</p>



<a name="248634940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248634940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248634940">(Aug 06 2021 at 16:36)</a>:</h4>
<p>words are hard. we should stop using them. ;)</p>



<a name="248635814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248635814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248635814">(Aug 06 2021 at 16:43)</a>:</h4>
<p>We do not intend to change the behavior or non const patterns here, do we?</p>



<a name="248635896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248635896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248635896">(Aug 06 2021 at 16:43)</a>:</h4>
<p>because I am still a bit hung up on<br>
<span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248623190">said</a>:</p>
<blockquote>
<blockquote>
<p>better warnings: <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=c5c74a76dbe1c2527be6fd3aee1cc796</a></p>
</blockquote>
<p>if this uses <code>PartialEq</code> comparison, the 2nd arm actually is reachable with "evil" implementations...</p>
</blockquote>



<a name="248635972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248635972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248635972">(Aug 06 2021 at 16:44)</a>:</h4>
<p>or wait</p>



<a name="248636039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636039">(Aug 06 2021 at 16:44)</a>:</h4>
<p>aaaaaaaa</p>



<a name="248636042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636042">(Aug 06 2021 at 16:44)</a>:</h4>
<p>god damn it</p>



<a name="248636286"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636286" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636286">(Aug 06 2021 at 16:46)</a>:</h4>
<p>you are not saying that the first branch ignores <code>value: true</code> if the <code>Foo::partial_eq</code> impl is evil</p>



<a name="248636369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636369">(Aug 06 2021 at 16:47)</a>:</h4>
<p><span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span> i still don't fully understand what you mean here <span class="user-mention" data-user-id="120791">@RalfJ</span>.</p>



<a name="248636458"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636458" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636458">(Aug 06 2021 at 16:47)</a>:</h4>
<p>So, the reason that we don't warn with proposal 2 is that our pattern is actually reachable and calls <code>PartialEq</code> for <code>Foo</code></p>



<a name="248636560"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636560" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636560">(Aug 06 2021 at 16:48)</a>:</h4>
<p>which the compiler doesn't reason about, so it doesn't know that this pattern doesn't trigger</p>



<a name="248636620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636620">(Aug 06 2021 at 16:49)</a>:</h4>
<p>now, an impl of <code>PartialEq</code> for <code>Foo</code> which does not care about <code>value</code> or might actually cause that branch to be taken</p>



<a name="248636645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248636645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248636645">(Aug 06 2021 at 16:49)</a>:</h4>
<p>which afaict is what you're saying here</p>



<a name="248637443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637443">(Aug 06 2021 at 16:54)</a>:</h4>
<p>yeah I should have worked this out in more detail, sorry (kind of in a rush and on the road -- or rather, rail -- most of today)</p>



<a name="248637484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637484">(Aug 06 2021 at 16:55)</a>:</h4>
<p>but I think there's a way to implement <code>PartialEq</code> for <code>Foo</code> that makes the 2nd arm reachable, right?</p>



<a name="248637518"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637518" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637518">(Aug 06 2021 at 16:55)</a>:</h4>
<p>absolutely</p>



<a name="248637562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637562">(Aug 06 2021 at 16:55)</a>:</h4>
<p>like, making it always return <code>true</code></p>



<a name="248637587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637587">(Aug 06 2021 at 16:55)</a>:</h4>
<p>it just wasn't related to what i wanted to say wrt the difference between proposal 1 and 2, so I simply misinterpreted your comment</p>



<a name="248637600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637600">(Aug 06 2021 at 16:55)</a>:</h4>
<p>that impl is even pure and satisfies all the axioms of <code>PartialEq</code>, so its actually entirely reasonable</p>



<a name="248637683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637683">(Aug 06 2021 at 16:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248637587">said</a>:</p>
<blockquote>
<p>it just wasn't related to what i wanted to say wrt the difference between proposal 1 and 2, so I simply misinterpreted your comment</p>
</blockquote>
<p>ah okay. multi-layered confusion. fun.^^</p>



<a name="248637973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248637973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248637973">(Aug 06 2021 at 16:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248632027">said</a>:</p>
<blockquote>
<p>the one I prefer is that a type implementing StructuralEq must have all of its values successfully convert to valtrees</p>
</blockquote>
<p>doesn't that one not work because of enums?</p>



<a name="248638020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248638020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248638020">(Aug 06 2021 at 16:58)</a>:</h4>
<p><a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=5d05d4b52be8d04d76ab426eabfd2d2f">https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=5d05d4b52be8d04d76ab426eabfd2d2f</a></p>



<a name="248638096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248638096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248638096">(Aug 06 2021 at 16:59)</a>:</h4>
<p>to slowly remove the rest of my remaining confusion wrt patterns</p>



<a name="248651254"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248651254" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248651254">(Aug 06 2021 at 18:39)</a>:</h4>
<p>I dont understand what the problem is with that example?</p>



<a name="248651315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248651315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248651315">(Aug 06 2021 at 18:39)</a>:</h4>
<p>is it that this should be rejected?</p>



<a name="248651377"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248651377" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248651377">(Aug 06 2021 at 18:40)</a>:</h4>
<p>the match is not exhaustive if the const is treated opaquely</p>



<a name="248651393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248651393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248651393">(Aug 06 2021 at 18:40)</a>:</h4>
<p>so yeah this should really be rejected...</p>



<a name="248651495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248651495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248651495">(Aug 06 2021 at 18:41)</a>:</h4>
<p>there's not even a warning :(</p>



<a name="248654447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248654447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248654447">(Aug 06 2021 at 19:02)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/213817-t-lang/topic/structural.20equality.20meeting/near/248651393">said</a>:</p>
<blockquote>
<p>so yeah this should really be rejected...</p>
</blockquote>
<p>i think we explicitly worked to not reject that, that's the reason we have a controlflow based structural match check</p>



<a name="248654585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/structural%20equality%20meeting/near/248654585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/structural.20equality.20meeting.html#248654585">(Aug 06 2021 at 19:03)</a>:</h4>
<p>it would be interesting to have crater results for that, because I don't really know what we can break and what's relied on</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>